﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spring.Context;
using System.Configuration;
using Spring.Context.Support;

namespace CsharpTrainer.Strategy.Hello
{
    public class HelloAlgorithm
    {
        public static void SayHello()
        {
            try
            {
                //从config文件中取得程序集信息
                IApplicationContext context = ConfigurationManager.GetSection("spring/context") as IApplicationContext;

                //调用方法
                IStrategy alg = context.GetObject("algHello") as IStrategy;
                alg.Execute();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
    }
}
